package com.benjaminwan.read.free.utils

import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment

fun Fragment.setTitle(@StringRes id: Int) {
    (requireActivity() as AppCompatActivity).supportActionBar?.setTitle(id)
}

fun Fragment.setTitle(title: CharSequence?) {
    (requireActivity() as AppCompatActivity).supportActionBar?.title = title
}

fun Fragment.setSubtitle(@StringRes id: Int) {
    (requireActivity() as AppCompatActivity).supportActionBar?.setSubtitle(id)
}

fun Fragment.setSubtitle(title: CharSequence?) {
    (requireActivity() as AppCompatActivity).supportActionBar?.subtitle = title
}